package com.jixiang.goods.controller;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jixiang.model.common.dtos.ResponseResult;
import com.jixiang.model.goods.dtos.CartDtos;
import com.jixiang.model.goods.entity.GsCard;
import com.jixiang.goods.service.GsCardService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * (GsCard)表控制层
 *
 * @author makejava
 * @since 2023-11-04 00:09:09
 */
@RestController
@RequestMapping("cart")
public class GsCardController extends ApiController {
    /**
     * 服务对象
     */
    @Resource
    private GsCardService gsCardService;

    @ApiOperation("获取用戶购物车数据")
    @GetMapping("/appGetCart")
    public ResponseResult appGetCart(){
        return gsCardService.appGetCart();
    }

    @ApiOperation("添加用戶购物车数据")
    @PostMapping("/appAddCart")
    public ResponseResult appAddCart(@RequestBody(required = true)CartDtos cartDtos){
        return gsCardService.appAddCart(cartDtos);
    }


    @ApiOperation("删除用戶购物车数据")
    @PostMapping("/appDelCart")
    public ResponseResult appDelCart(@RequestBody(required = true)CartDtos cartDtos){
        return gsCardService.appDelCart(cartDtos);
    }


    @ApiOperation("合并用戶购物车数据")
    @PostMapping("/appMergeCartData")
    public ResponseResult appMergeCartData(@RequestBody(required = true)List<CartDtos> cartDtosList){
        return gsCardService.appMergeCartData(cartDtosList);
    }
}

